/***********************************************************
! @File        : mainmanager.h
 *  @Brief       : 提供给qml的接口
 *  @Details     : 截图功能，发送邮件功能
 *  @Author      : soda
 *  @Date        : 2023-11-06 10:36:36
 *  @Version     : v1.0
 *  @Copyright   : Copyright By soda, All Rights Reserved
 ***********************************************************/

#pragma once
#include <iostream>
#include <QObject>
#include <QQmlEngine>
#include <QApplication>
#include <classes.h>
#include <QTimer>
#include "jwsmtp/jwsmtp/jwsmtp.h"

class HttpRequest;
class MainManager : public QObject
{
    Q_OBJECT
public:
    explicit MainManager(QObject *parent = nullptr);
    ~MainManager();

    static void declareQML();

    // 主界面的相关信息
    Q_INVOKABLE QString getApplicationDirPath();
    Q_INVOKABLE QString getTitleName();
    Q_INVOKABLE void quitApp();
    Q_INVOKABLE void getStockInfo(QString code);



signals:
    void signalStockInfomation(const QString& name, const QString& price);
    void signalHold(const float unitPrice, const int number, const float money);
    void signalCurrentCode(const int code);

private:
    HttpRequest* m_httpPost = nullptr;
    QTimer m_timer;
    jwsmtp::mailer* m_mailer = nullptr;
};


